import pytest

from common.logger import logger
from base_object.user_manage import *


@pytest.fixture(scope="function", autouse=True)
def get_case_name(request):
    logger.info(30 * "*" + f"开始执行用例" + 30 * "*" + "\n")
    yield
    logger.info(30 * "*" + "用例执行结束" + 30 * "*" + "\n")

@pytest.fixture
def login_from_fixture():
    account = 'testertemp_90@qq.com'
    password = 'cc1234'
    return account, password, login(0,account=account, password=password, notice=None, sourceplatform='RETONE_FIT')

@pytest.fixture
def login1():
    return login(0, account='testertemp_24@qq.com', password='cc1234', notice=None, sourceplatform='RETONE_FIT')

def pytest_collection_modifyitems(items):
    """
    测试用例收集完成时，将收集到的item的name和nodeid的中文显示在控制台上
    :return:
    """
    for item in items:
        item.name = item.name.encode("utf-8").decode("unicode_escape")
        print(item.nodeid)
        item._nodeid = item.nodeid.encode("utf-8").decode("unicode_escape")